package es.efor.ics.gev.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import es.efor.ics.gev.dao.RoleDao;
import es.efor.ics.gev.model.Role;
import es.efor.ics.gev.service.RoleManager;

/**
 * Implementation of RoleManager interface.
 * 
 * @author <a href="mailto:dan@getrolling.com">Dan Kibler</a>
 */
public class RoleManagerImpl extends GenericManagerImpl<Role, Long> implements RoleManager {
	@Autowired	
	RoleDao roleDao;

    /**
     * {@inheritDoc}
     */
    public List<Role> getRoles(Role role) {
        return roleDao.getAll();
    }

    /**
     * {@inheritDoc}
     */
    public Role getRole(String rolename) {
        return roleDao.getRoleByName(rolename);
    }

    /**
     * {@inheritDoc}
     */
    public Role saveRole(Role role) {
        return roleDao.save(role);
    }

    /**
     * {@inheritDoc}
     */
    public void removeRole(String rolename) {
        roleDao.removeRole(rolename);
    }
}